<template>
  <div class="pa30 pb100">
    <el-row class="marginT20">
      <el-col :span="8">
        <el-input v-model="leaveWordUserQuery.condition" placeholder="搜索用户ID">
          <el-button slot="append" type="primary" icon="el-icon-search" />
        </el-input>
        <div class="marginT30" style="overflow:auto; height: 600px; ">
          <userList />
        </div>
      </el-col>
      <el-col :span="14" :offset="2">右侧内容</el-col>
    </el-row>
    <!-- <div class="main-wrapper">
      <custom-table :data="listData" :columns="columns">
        <template slot-scope="{ row }">
          <el-button type="text" @click="getDetail(row.userId)">查看详情</el-button>
        </template>
      </custom-table>
      <pagination :total="total" :custom-total="customTotal" @pagination="pagination" />
    </div>-->
  </div>
</template>

<script>
import { getUsersList } from '@/api/users';
import userList from './component/userList';

export default {
  name: 'List',
  components: {
    userList
  },
  data () {
    return {
      loading: false,
      // 联系记录 - 用户列表
      leaveWordUserList: null,
      leaveWordUserQuery: {
        condition: this.$route.query.param,
        pager: {
          page: 1,
          pageSize: 10
        }
      }
    };
  },
  created () {
    // this.init();
  },
  methods: {
    init () {
      this.loading = true;
      getUsersList(this.listQuery)
        .then(res => {
          if (this.checkArr(res.data.records)) {
            res.data.records.map((item, index) => {
              item.statusTxt = item.status === 'ENABLE' ? '正常' : '冻结';
              item.authenticatedTxt = item.authenticated ? '认证' : '未认证';
            });
          }
          this.listData = res.data.records;
          this.total = res.data.total;
          this.loading = res.loading;
        })
        .catch(error => {
          this.loading = false;
        });
    },

    pagination ({ page, limit }) {
      this.listQuery.pager.page = page;
      this.listQuery.pager.pageSize = limit;
      this.init();
    },
    getDetail (id) {
      this.$router.push({
        path: `/user/UserDetails`,
        query: { param: id }
      });
    }
  }
};
</script>

<style lang="scss" scoped>
.search-wrap {
  border-bottom: none;
}
</style>
